import { BasicColumn } from '/src/components/Table';
import { FormSchema } from '/src/components/Table';
import { rules } from '/src/utils/helper/validator';
import { render } from '/src/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/src/utils';
//列表数据
export const columns: BasicColumn[] = [
  {
    title: '产品名称',
    align: 'center',
    dataIndex: 'prodName',
  },
  {
    title: 'SKU名称',
    align: 'center',
    dataIndex: 'skuName',
  },
  {
    title: '数量',
    align: 'center',
    dataIndex: 'prodCount',
    width: 50,
  },
  {
    title: '单价',
    align: 'center',
    dataIndex: 'price',
    width: 50,
  },
  {
    title: '产品总额',
    align: 'center',
    dataIndex: 'productTotalAmount',
    width: 100,
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: 'SKU名称',
    field: 'skuName',
    component: 'Input',
  },
  {
    label: '产品名称',
    field: 'prodName',
    component: 'Input',
  },
  {
    label: '数量',
    field: 'prodCount',
    component: 'Input',
  },
  {
    label: '图片',
    field: 'pic',
    component: 'Input',
  },
  {
    label: '单价',
    field: 'price',
    component: 'InputNumber',
  },
  {
    label: '产品总额',
    field: 'productTotalAmount',
    component: 'InputNumber',
  },
  {
    label: '订单号',
    field: 'orderNumber',
    component: 'Input',
  },
  // TODO 主键隐藏字段，目前写死为ID
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  prodId: { title: '产品SPU', order: 0, view: 'text', type: 'string' },
  skuId: { title: '产品SKU', order: 1, view: 'text', type: 'string' },
  prodCount: { title: '数量', order: 2, view: 'text', type: 'string' },
  prodName: { title: '产品名称', order: 3, view: 'text', type: 'string' },
  skuName: { title: 'SKU名称', order: 4, view: 'text', type: 'string' },
  pic: { title: '图片', order: 5, view: 'text', type: 'string' },
  price: { title: '单价', order: 6, view: 'number', type: 'number' },
  productTotalAmount: { title: '产品总额', order: 7, view: 'number', type: 'number' },
  commSts: { title: '评论状态', order: 8, view: 'number', type: 'number' },
  cartDate: { title: '加入购物车时间', order: 9, view: 'datetime', type: 'string' },
  orderNumber: { title: '订单号', order: 10, view: 'text', type: 'string' },
  shopId: { title: '门店标识', order: 11, view: 'text', type: 'string' },
  userId: { title: '用户', order: 12, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
